package uk.ac.ebi.uniprot.wikipedia.model;

/**
 * Created with IntelliJ IDEA.
 * User: ljgarcia
 * Date: 11/06/12
 * Time: 15:24
 * To change this template use File | Settings | File Templates.
 */
public class GeneWikiPage implements Comparable<GeneWikiPage>{
    protected String wikiURL;
    protected String accession;
    protected String geneId;

    public GeneWikiPage() {

    }

    public GeneWikiPage(String wikiURL, String geneId, String accession) {
        this.accession = accession;
        this.geneId = geneId;
        this.wikiURL = wikiURL;
    }

    public String getAccession() {
        return accession;
    }

    public void setAccession(String accession) {
        this.accession = accession;
    }

    public String getGeneId() {
        return geneId;
    }

    public void setGeneId(String geneId) {
        this.geneId = geneId;
    }

    public String getWikiURL() {
        return wikiURL;
    }

    public void setWikiURL(String wikiURL) {
        this.wikiURL = wikiURL;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        GeneWikiPage that = (GeneWikiPage) o;

        if (!geneId.equals(that.geneId)) return false;
        if (!wikiURL.equals(that.wikiURL)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = wikiURL.hashCode();
        result = 31 * result + geneId.hashCode();
        return result;
    }

    @Override
    public int compareTo(GeneWikiPage o) {
        if (this.equals(o)) {
            return 0;
        }
        return (this.wikiURL+this.geneId).compareTo(o.wikiURL+o.geneId);
    }

    @Override
    public String toString() {
        return "GeneWikiPage{" +
                "wikiURL='" + wikiURL + '\'' +
                ", accession='" + accession + '\'' +
                ", geneId='" + geneId + '\'' +
                '}';
    }
}
